<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" integrity="sha256-Z1K5uhUaJXA7Ll0XrZ/0JhX4lAtZFpT6jkKrEDT0drU=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"example.com","root":"/","images":"/images","scheme":"Muse","darkmode":false,"version":"8.14.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":false,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":-1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="默认情况下容器使用的资源是不受限制的。也就是可以使用主机内核调度器所允许的最大资源。但是在容器的使用过程中，经常需要对容器可以使用的主机资源进行限制，本文介绍如何限制容器可以使用的主机内存。  压测工具使用ubuntu的stress 作为压测工具，并制作镜像 1234FROM ubuntu:latestRUN apt-get update &amp;&amp; \        apt-get">
<meta property="og:type" content="article">
<meta property="og:title" content="Docker容器限制Memory">
<meta property="og:url" content="http://example.com/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/index.html">
<meta property="og:site_name" content="JsyBlog">
<meta property="og:description" content="默认情况下容器使用的资源是不受限制的。也就是可以使用主机内核调度器所允许的最大资源。但是在容器的使用过程中，经常需要对容器可以使用的主机资源进行限制，本文介绍如何限制容器可以使用的主机内存。  压测工具使用ubuntu的stress 作为压测工具，并制作镜像 1234FROM ubuntu:latestRUN apt-get update &amp;&amp; \        apt-get">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://example.com/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory-0.png">
<meta property="og:image" content="http://example.com/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory-1.png">
<meta property="og:image" content="http://example.com/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory-2.png">
<meta property="og:image" content="http://example.com/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory-3.png">
<meta property="article:published_time" content="2022-06-10T02:49:04.000Z">
<meta property="article:modified_time" content="2023-04-08T08:04:56.586Z">
<meta property="article:author" content="SongyangJi">
<meta property="article:tag" content="Docker">
<meta property="article:tag" content="资源限制">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://example.com/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory-0.png">


<link rel="canonical" href="http://example.com/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://example.com/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/","path":"2022/06/10/Docker容器限制Memory/","title":"Docker容器限制Memory"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>Docker容器限制Memory | JsyBlog</title>
  








  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">JsyBlog</p>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%8E%8B%E6%B5%8B%E5%B7%A5%E5%85%B7"><span class="nav-number">1.</span> <span class="nav-text">压测工具</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E9%99%90%E5%88%B6%E5%AE%B9%E5%99%A8%E5%AF%B9%E5%86%85%E5%AD%98%E7%9A%84%E4%BD%BF%E7%94%A8%EF%BC%9F"><span class="nav-number">2.</span> <span class="nav-text">为什么要限制容器对内存的使用？</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E9%99%90%E5%88%B6Memory"><span class="nav-number">3.</span> <span class="nav-text">限制Memory</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E9%99%90%E5%88%B6%E5%86%85%E5%AD%98%E4%BD%BF%E7%94%A8%E4%B8%8A%E9%99%90"><span class="nav-number">3.1.</span> <span class="nav-text">限制内存使用上限</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E9%99%90%E5%88%B6%E5%8F%AF%E7%94%A8%E7%9A%84-swap-%E5%A4%A7%E5%B0%8F"><span class="nav-number">3.2.</span> <span class="nav-text">限制可用的 swap 大小</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%80%BB%E7%BB%93"><span class="nav-number">4.</span> <span class="nav-text">总结</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">SongyangJi</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">251</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">45</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">109</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="SongyangJi">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="JsyBlog">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="Docker容器限制Memory | JsyBlog">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Docker容器限制Memory
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2022-06-10 10:49:04" itemprop="dateCreated datePublished" datetime="2022-06-10T10:49:04+08:00">2022-06-10</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2023-04-08 16:04:56" itemprop="dateModified" datetime="2023-04-08T16:04:56+08:00">2023-04-08</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/Docker/" itemprop="url" rel="index"><span itemprop="name">Docker</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <blockquote>
<p>默认情况下容器使用的资源是不受限制的。也就是可以使用主机内核调度器所允许的最大资源。但是在容器的使用过程中，经常需要对容器可以使用的主机资源进行限制，本文介绍如何限制容器可以使用的主机内存。</p>
</blockquote>
<h1 id="压测工具"><a href="#压测工具" class="headerlink" title="压测工具"></a>压测工具</h1><p>使用ubuntu的<code>stress</code> 作为压测工具，并制作镜像</p>
<figure class="highlight dockerfile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">FROM</span> ubuntu:latest</span><br><span class="line"></span><br><span class="line"><span class="keyword">RUN</span><span class="language-bash"> apt-get update &amp;&amp; \</span></span><br><span class="line"><span class="language-bash">        apt-get install stress</span></span><br></pre></td></tr></table></figure>
<p>shell命令</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker build -t u-stress:latest .</span><br></pre></td></tr></table></figure>







<h1 id="为什么要限制容器对内存的使用？"><a href="#为什么要限制容器对内存的使用？" class="headerlink" title="为什么要限制容器对内存的使用？"></a>为什么要限制容器对内存的使用？</h1><p>限制容器不能过多的使用主机的内存是非常重要的。对于 linux 主机来说，一旦内核检测到没有足够的内存可以分配，就会扔出 OOME(Out Of Memmory Exception)，并开始杀死一些进程用于释放内存空间。糟糕的是任何进程都可能成为内核猎杀的对象，包括 docker daemon 和其它一些重要的程序。更危险的是如果某个支持系统运行的重要进程被干掉了，整个系统也就宕掉了！这里我们考虑一个比较常见的场景，大量的容器把主机的内存消耗殆尽，OOME 被触发后系统内核立即开始杀进程释放内存。如果内核杀死的第一个进程就是 docker daemon 会怎么样？结果是没有办法管理运行中的容器了，这是不能接受的！<br>针对这个问题，docker 尝试通过调整 docker daemon 的 OOM 优先级来进行缓解。内核在选择要杀死的进程时会对所有的进程打分，直接杀死得分最高的进程，接着是下一个。当 docker daemon 的 OOM 优先级被降低后(注意容器进程的 OOM 优先级并没有被调整)，docker daemon 进程的得分不仅会低于容器进程的得分，还会低于其它一些进程的得分。这样 docker daemon 进程就安全多了。</p>
<p>我们可以通过下面的脚本直观的看一下当前系统中所有进程的得分情况：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">!/bin/bash</span></span><br><span class="line">number=$1</span><br><span class="line">for proc in $(find /proc -maxdepth 1 -regex &#x27;/proc/[0-9]+&#x27;); do</span><br><span class="line">    printf &quot;%2d %5d %s\n&quot; \</span><br><span class="line">        &quot;$(cat $proc/oom_score)&quot; \</span><br><span class="line">        &quot;$(basename $proc)&quot; \</span><br><span class="line">        &quot;$(cat $proc/cmdline | tr &#x27;\0&#x27; &#x27; &#x27; | head -c 50)&quot;</span><br><span class="line">done 2&gt;/dev/null | sort -nr | head -n &quot;$number&quot;</span><br></pre></td></tr></table></figure>



<p>此脚本输出得分最高的 40 个进程，并进行了排序：</p>
<p><img src="/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory-0.png"></p>
<p>第一列显示进程的得分，mysqld 排到的第一名。显示为 node server.js 的都是容器进程，排名普遍比较靠前。红框中的是 docker daemon 进程，非常的靠后，都排到了 sshd 的后面。</p>
<p>有了上面的机制后是否就可以高枕无忧了呢！不是的，docker 的官方文档中一直强调这只是一种缓解的方案，并且为我们提供了一些降低风险的建议：</p>
<ul>
<li>通过测试掌握应用对内存的需求</li>
<li>保证运行容器的主机有充足的内存</li>
<li>限制容器可以使用的内存</li>
<li>为主机配置 swap</li>
</ul>
<p>其实就是说：通过限制容器使用的内存上限，可以降低主机内存耗尽时带来的各种风险。</p>
<h1 id="限制Memory"><a href="#限制Memory" class="headerlink" title="限制Memory"></a>限制Memory</h1><p>&#x2F;Users&#x2F;jisongyang&#x2F;go&#x2F;pkg&#x2F;mod&#x2F;github.com&#x2F;docker&#x2F;<a href="mailto:&#x64;&#111;&#x63;&#107;&#x65;&#x72;&#x40;&#x76;&#50;&#48;&#x2e;&#49;&#48;&#46;&#49;&#x35;">&#x64;&#111;&#x63;&#107;&#x65;&#x72;&#x40;&#x76;&#50;&#48;&#x2e;&#49;&#48;&#46;&#49;&#x35;</a>+incompatible&#x2F;api&#x2F;types&#x2F;container&#x2F;host_config.go</p>
<h2 id="限制内存使用上限"><a href="#限制内存使用上限" class="headerlink" title="限制内存使用上限"></a>限制内存使用上限</h2><p>使用<code>-m(--memory=)</code>可以限制容器使用的最大内存。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -it -m 300M --memory-swap -1 --name con1 u-stress /bin/bash</span><br></pre></td></tr></table></figure>



<p>下面的 stress 命令会创建一个进程并通过 malloc 函数分配内存：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">stress --vm 1 --vm-bytes 500M</span><br></pre></td></tr></table></figure>

<p>通过 docker stats 命令查看实际情况：<br><img src="/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory-1.png"></p>
<p>上面的 docker run 命令中通过 -m 选项限制容器使用的内存上限为 300M。同时设置 memory-swap 值为 -1，它表示容器程序使用内存的受限，而可以使用的 swap 空间使用不受限制(宿主机有多少 swap 容器就可以使用多少)。<br>下面我们通过 top 命令来查看 stress 进程内存的实际情况：<br><img src="/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory-2.png"></p>
<p>上面的截图中先通过 pgrep 命令查询 stress 命令相关的进程，进程号比较大的那个是用来消耗内存的进程，我们就查看它的内存信息。VIRT 是进程虚拟内存的大小，所以它应该是 500M。RES 为实际分配的物理内存数量，我们看到这个值就在 300M 上下浮动。看样子我们已经成功的限制了容器能够使用的物理内存数量。</p>
<h2 id="限制可用的-swap-大小"><a href="#限制可用的-swap-大小" class="headerlink" title="限制可用的 swap 大小"></a>限制可用的 swap 大小</h2><p>强调一下 –memory-swap 是必须要与 –memory 一起使用的。</p>
<p>正常情况下， –memory-swap 的值包含容器可用内存和可用 swap。所以 –memory&#x3D;”300m” –memory-swap&#x3D;”1g” 的含义为：<br>容器可以使用 300M 的物理内存，并且可以使用 700M(1G -300M) 的 swap。–memory-swap 是容器可以使用的物理内存和可以使用的 swap 之和。</p>
<p>把 –memory-swap 设置为 0 和不设置是一样的，此时如果设置了 –memory，容器可以使用的 swap 大小为 –memory 值的两倍。（也就是说缺省情况下swap空间刚好为1倍的memory）</p>
<p><strong>如果 –memory-swap 的值和 –memory 相同，则容器不能使用 swap</strong>。下面的 demo 演示了在没有 swap 可用的情况下向系统申请大量内存的场景：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">docker run -it --<span class="built_in">rm</span> -m 300M --memory-swap=300M u-stress /bin/bash</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">stress --vm 1 --vm-bytes 500M</span></span><br></pre></td></tr></table></figure>

<p><img src="/2022/06/10/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6Memory-3.png"></p>
<p>demo 中容器的物理内存被限制在 300M，但是进程却希望申请到 500M 的物理内存。在没有 swap 可用的情况下，进程直接被 OOM kill 了。如果有足够的 swap，程序至少还可以正常的运行。</p>
<p>我们可以通过 –oom-kill-disable 选项强行阻止 OOM kill 的发生，但是最好不要。</p>
<h1 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h1><p>通过限制容器可用的物理内存，可以避免容器内服务异常导致大量消耗主机内存的情况(此时让容器重启是较好的策略)，因此可以降低主机内存被耗尽带来的风险。</p>
<p><a target="_blank" rel="noopener" href="https://sanhe-dev-exp-share.readthedocs.io/03-Docker/03-Restrict-CPU-Memory-and-GPU/README.html">https://sanhe-dev-exp-share.readthedocs.io/03-Docker/03-Restrict-CPU-Memory-and-GPU/README.html</a></p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/Docker/" rel="tag"># Docker</a>
              <a href="/tags/%E8%B5%84%E6%BA%90%E9%99%90%E5%88%B6/" rel="tag"># 资源限制</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2022/06/09/Docker%E5%AE%B9%E5%99%A8%E9%99%90%E5%88%B6CPU/" rel="prev" title="Docker容器限制CPU">
                  <i class="fa fa-chevron-left"></i> Docker容器限制CPU
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2022/06/11/%E6%9F%A5%E7%9C%8Bdocker%E5%AE%B9%E5%99%A8%E5%9C%A8%E5%AE%BF%E4%B8%BB%E6%9C%BA%E4%B8%AD%E7%9A%84pid/" rel="next" title="查看docker容器在宿主机中的pid">
                  查看docker容器在宿主机中的pid <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">SongyangJi</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/muse/" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>
  <div class="sidebar-dimmer"></div>
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>





  





</body>
</html>
